
//  ProductCommentCell.m
//  LoveTrail
//
//  Created by giantumbrella on 15/6/16.
//  Copyright (c) 2015年 赵娟. All rights reserved.
//

#import "ProductCommentCell.h"
#import "CommonMacro.h"
@implementation ProductCommentCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self initWithSubViews];
    }
    return self;
}

- (void)initWithSubViews
{
    CGFloat buttonX = 0;
    CGFloat buttonY = 0;
    CGFloat buttonW = SCREEN_WIDTH*0.5;
    CGFloat buttonH = 30;
    //1.商品详情
    self.productDetailButton = [[UIButton alloc] initWithFrame:CGRectMake(buttonX, buttonY, buttonW, buttonH)];
    [self.productDetailButton setTitle:@"商品详情" forState:UIControlStateNormal];
    [self.productDetailButton setTitleColor:UIColorWithRGBA(202, 202, 202, 1)forState:UIControlStateNormal];
    [self.productDetailButton setTitleColor:UIColorWithRGBA(221, 94, 73, 1) forState:UIControlStateSelected];
    self.productDetailButton.selected = YES;
    self.lastButton = self.productDetailButton;
    
    
    self.productDetailButton.tag = 1000;
    [self addSubview:self.productDetailButton];
    [self.productDetailButton addTarget:self action:@selector(clickButtonDone:) forControlEvents:UIControlEventTouchUpInside];
    
    //2.商品评价
    self.commentProductButton = [[UIButton alloc] initWithFrame:CGRectMake(buttonW, buttonY, buttonW, buttonH)];
    [self.commentProductButton setTitle:@"商品评论" forState:UIControlStateNormal];
    [self.commentProductButton setTitleColor:UIColorWithRGBA(221, 94, 73, 1)forState:UIControlStateNormal];
    [self.commentProductButton setTitleColor:UIColorWithRGBA(221, 94, 73, 1) forState:UIControlStateSelected];
    self.commentProductButton.tag = 1001;
    
    [self addSubview:self.commentProductButton];
    [self.commentProductButton addTarget:self action:@selector(clickButtonDone:) forControlEvents:UIControlEventTouchUpInside];
    
    //添加一个中间的line
    UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(buttonW, buttonY, 0.5, buttonH)];
    lineView.backgroundColor = UIColorWithRGBA(238, 238, 238, 1);
    [self addSubview:lineView];
}

#pragma mark 代理方法
- (void)clickButtonDone:(UIButton *)button
{
    if ([self.delegate respondsToSelector:@selector(clickButtonChangeContent:)]) {
        [self.delegate clickButtonChangeContent:button];
    }
}
@end
